package com.slfx.data.permission.controller;

import com.slfx.data.permission.entity.DataAuth;
import com.slfx.data.permission.service.DataAuthService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: slfx
 * @Date: 2023-01-02
 * @Description:
 **/
@RestController
@RequestMapping("/dataAuth")
public class DataAuthController {

    @Resource
    private DataAuthService dataAuthService;

    /**
     * 根据ID获取
     *
     * @param id
     * @return
     */
    @GetMapping("/getById")
    public DataAuth getById(@RequestParam("id") Long id) {
        DataAuth dataAuth = dataAuthService.getById(id);
        return dataAuth;
    }

    /**
     * 新增
     *
     * @param dataAuth
     * @return
     */
    @PostMapping("/save")
    public Integer save(@RequestBody DataAuth dataAuth) {
        dataAuthService.save(dataAuth);
        return dataAuth.getId();
    }

}
